<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateInvoiceHeaderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('invoice_header', function (Blueprint $table) {
            $table->id();
            $table->unsignedTinyInteger('headerType')->default(0)->comment('抬头类型： 0个人， 1企业');
            $table->unsignedTinyInteger('invoiceType')->default(0)->comment('发票类型： 0普通发票，1专用发票');
            $table->string('invoiceTitle',36)->default("个人")->comment('发票抬头');
            $table->string('companyTaxNumber',18)->default("")->comment('公司税号');
            $table->string('companyRegisterAddress',255)->default("")->comment('注册地址');
            $table->string('companyRegisterMobile',20)->default("")->comment('注册电话');
            $table->string('companyDepositBank',50)->default("")->comment('开户银行');
            $table->string('companyDepositBankNum',)->default("")->comment('银行账户卡号');
            $table->string('email',120)->default("")->comment('邮箱地址');
            $table->string('mobile',11)->default("")->comment('手机号码');
            $table->unsignedTinyInteger('invoiceDefault')->default("0")->comment('是否默认:0否，1是');

            $table->unsignedInteger('merchantUserId')->default(0)->comment('rms userId');
            $table->unsignedInteger('shopId')->default(0)->comment('门店Id');

            $table->index('shopId', 'idx_shopId');
            $table->index('merchantUserId', 'idx_merchantUserId');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '发票管理-发票抬头';

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('invoice_header');
    }
}
